package cn.hs.lyxf.basic;

import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Package: cn.hs.lyxf.basic
 * @ClassName: ContractNo
 * @Date:2022/12/9 21:33
 * @Description:
 */
public class ContractNo {
    /**
     * 生成合同编号
     *
     * @param maxCount
     * @return
     */
    public static String recountNew(int maxCount) {
        if (maxCount < 0) {
            return null;
        }
        // 20170731FXJT99999999
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        String str = format.format(new Date());
        maxCount = maxCount + 1;
        NumberFormat nf = NumberFormat.getInstance();
        //设置是否使用分组
        nf.setGroupingUsed(false);
        //设置最大整数位数
        nf.setMaximumIntegerDigits(9);
        //设置最小整数位数
        nf.setMinimumIntegerDigits(9);
        String countStr = str + "ZHY" + nf.format(maxCount);
        System.out.println("合同编号: " + countStr);
        return countStr;
    }

}
